package github.leavesczy.reactivehttpsamples

import android.app.Application
import android.content.Context
import com.scwang.smart.refresh.footer.ClassicsFooter
import com.scwang.smart.refresh.header.ClassicsHeader
import com.scwang.smart.refresh.header.MaterialHeader
import com.scwang.smart.refresh.layout.SmartRefreshLayout
import com.scwang.smart.refresh.layout.api.RefreshLayout
import com.scwang.smart.refresh.layout.listener.DefaultRefreshInitializer
import github.leavesczy.reactivehttpsamples.util.Logger

/**
 * @Author: leavesCZY
 * @Date: 2020/10/26 15:30
 * @Desc:
 * @Github：https://github.com/leavesCZY
 */
class MainApplication : Application() {

    companion object {

        lateinit var context: Application

    }

    init {
        //设置全局的Header构建器
        SmartRefreshLayout.setDefaultRefreshHeaderCreator { context, layout ->
            //layout.setPrimaryColorsId(R.color.colorPrimary, android.R.color.white)
            MaterialHeader(context).setColorSchemeResources(R.color.colorAccentOrigin,R.color.colorPrimaryOrigin,R.color.colorPrimary)
        }
        SmartRefreshLayout.setDefaultRefreshFooterCreator { context, layout ->
            ClassicsFooter(context).setDrawableSize(20f)
        }
        Logger.d("MainApplication-->init")
    }

    override fun onCreate() {
        super.onCreate()
        context = this
    }

}